package com.example.travel.service;

import com.example.travel.bean.LineBean;
import com.example.travel.mapper.LineMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LineService {

    @Autowired
    LineMapper lineMapper;

    public List<LineBean> getLineList() {
        return lineMapper.getLineList();
    }

    public int addLine(LineBean line) {
        return lineMapper.addLine(line);
    }

    public int deleteLine(int lineID) {
        return lineMapper.deleteLine(lineID);
    }

    public int updateLine(LineBean line) {
        return lineMapper.updateLine(line);
    }

    public List<LineBean> getLineListWithPagination(String searchKeyword, int offset, int pageSize) {
        return lineMapper.getLineListWithPagination(searchKeyword, offset, pageSize);
    }

    public int getLineCount(String searchKeyword) {
        return lineMapper.getLineCount(searchKeyword);
    }

    public List<LineBean> getLastLines() {
        return lineMapper.selectLeastOrderedLinesInLastMonth();
    }
}
